<template>
  <a-modal :title="title" :visible="visble" @cancel="handleCancel" footer="">
    <a-table :bordered="true" :columns="columns" :data-source="tableData"></a-table>
  </a-modal>
</template>

<script>
import api from '@/api/production';
export default {
  name: 'planModal',
  data() {
    return {
      visble: false,
      params: {
        id: '',
      },
      title: '生成计划详情',
      tableData: [],
      columns: [
        {
          dataIndex: 'macNum',
          title: '加工设备',
          key: 'macNum',
          align: 'center',
        },
        {
          title: '已完成件数',
          dataIndex: 'finishNum',
          key: 'finishNum',
          align: 'center',
        },
        {
          title: '起止时间',
          dataIndex: 'startAndEndDate',
          key: 'startAndEndDate',
          align: 'center',
        },
      ],
    };
  },
  methods: {
    showModal() {
      this.visble = true;
      this.getList();
    },
    handleCancel() {
      this.visble = false;
    },
    // 获取列表数据
    async getList() {
      const res = await api.getProductionDetail(this.params);
      if (res.msgCode === 0) {
        this.tableData = res.data;
      }
    },
  },
};
</script>

<style scoped></style>
